package com.doge.controller.admin;

import com.doge.bean.base.BaseData;
import com.doge.bean.base.BaseParam;
import com.doge.bean.base.BaseRespVo;
import com.doge.bean.pojo.comment.Comment;
import com.doge.exception.Delete502Exception;
import com.doge.service.admin.comment.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: project2-wechat-mall
 * @description:
 * @author: 305905917@qq.com
 * @create: 2021-11-29 21:39
 **/

@RestController
@RequestMapping("admin/comment")
public class CommentController {

    @Autowired
    CommentService commentService;

    //http://182.92.235.201:8083/admin/goods/list?page=1&limit=20&sort=add_time&order=desc
    @RequestMapping("list")
    public BaseRespVo list(BaseParam baseParam, Integer userId, Integer valueId) {
        BaseData baseData = commentService.list(baseParam, userId, valueId);

        return BaseRespVo.ok(baseData);

    }

    @PostMapping("delete")
    public BaseRespVo delete(@RequestBody Comment comment) throws Delete502Exception {
        commentService.delete(comment);
        return BaseRespVo.ok();
    }

}
